The invention relates generally to virtual memory translation caching in a computer system and more specifically to handling an accessed bit in a page table entry.
In a computer system, instructions and data are stored in a memory device until they are needed. The memory device is organized according to an addressing scheme to allow the instructions and data to be located by specifying an address. However, while the memory device is organized into a plurality of physical addresses, it is often useful for a processor to consider the instructions and data to be organized according to a different addressing scheme, denoted by virtual addresses. The virtual addresses may be converted to physical addresses to allow the instructions and data to be accessed in the memory device.
A translation lookaside buffer (TLB) structure may be used to provide a cache for translation of virtual addresses to physical addresses. The TLB structure includes a plurality of upper-level page tables, also referred to as page directories, that contain upper-level page table entries, also referred to as page directory entries. The TLB structure also includes a plurality of lower-level page tables that contain lower-level page table entries. The upper-level page table entries serve as pointers to the plurality of lower-level page tables and the lower-level page table entries serve as pointers to pages of data in the memory device.
FIG. 1 is a block diagram illustrating the relationship between a processor, a TLB structure, and memory. Processor 101 is coupled to and communicates in virtual addresses with TLB structure 102. TLB structure 102 is coupled to and communicates in physical addresses with main memory 103. Alternatively, processor 101 may communicate directly with main memory 103.
A virtual memory system makes it possible to generate addresses for address space in excess of that actually supported by physical memory devices. In such a virtual memory system, virtual memory pages are loaded into available physical memory devices as memory accesses are made to memory locations within those virtual memory pages. Other virtual memory pages that are no longer needed are written to a larger, but often slower, storage device, for example a hard disk drive. To manage the paging of such a virtual memory system, certain indications about the status of the virtual memory system are provided.
If changes are made that affect the TLB structure 102, a xe2x80x9cdirtyxe2x80x9d indication is provided to processor 101 so that processor 101 can maintain consistency between the TLB structure 102 and the main memory 103. An xe2x80x9caccessedxe2x80x9d indication is used by the operating system running on processor 101 to check memory usage. The xe2x80x9caccessedxe2x80x9d indication indicates a recent memory access. An electrical circuit provides the xe2x80x9caccessedxe2x80x9d indication, for example by asserting an xe2x80x9caccessedxe2x80x9d bit for an accessed page table entry in memory page tables from which the TLB structure 102 is loaded. Upon the first access to that accessed page table entry, the accessed bit is set and written back into main memory. xe2x80x9cAccessedxe2x80x9d indications can be used, for example, to implement a least-recently-used (LRU) replacement strategy for main memory pages.
The operating system running on processor 101 identifies accessed page table entries based on the xe2x80x9caccessedxe2x80x9d indications and resets the xe2x80x9caccessedxe2x80x9d indications, for example by deasserting the xe2x80x9caccessedxe2x80x9d bits. In the prior art, electrical circuits were provided to handle the assertion and deassertion of xe2x80x9caccessedxe2x80x9d indications. However, such electrical circuits occupy substantial space on an integrated circuit die. As the complexity of integrated circuits used in computers has increased, the amount of space on an integrated circuit die for such electrical circuits can no longer be afforded, as that space is now needed for other circuitry. Thus, the use of electrical circuits to handle the assertion and deassertion of xe2x80x9caccessedxe2x80x9d indications is no longer feasible.
Thus, a method and apparatus is needed to allow efficient handling of an accessed bit in a page table entry.